﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Consumer Manage - Open API Control Panel
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>Consumer Manage &gt; Consumer Level &gt; Add</legend>
        <table border="0" cellspacing="0" width="100%">
            <tr>
                <td width="150">
                    Consumer Level<font color="red">*</font>
                </td>
                <td>
                    <% =Html.TextBox("txtCONSUMER_LEVEL", "", new { @style = "width:250px"})%>
                </td>
            </tr>
            <tr>
                <td width="150">
                    Consumer Level Name<font color="red">*</font>
                </td>
                <td>
                    <% =Html.TextBox("txtCONSUMER_LEVEL_NAME", "", new { @style = "width:250px"})%>
                </td>
            </tr>
            <tr>
                <td width="150">
                    Consumer Level Desc
                </td>
                <td>
                    <% =Html.TextBox("txtCONSUMER_LEVEL_DESC", "", new { @style = "width:250px" })%>
                </td>
            </tr>
            <tr>
                <td width="150">
                    &nbsp;
                </td>
                <td>
                    <input type="button" id="btnConsumerLevelAdd" name="btnConsumerLevelAdd" value="Add Consumer Level" />
                    <input type="button" id="btnGoToList" name="btnGoToList" value="Go To List" />
                </td>
            </tr>
        </table>
    </fieldset>

    <script type="text/javascript" language="javascript">

        //json: Submit Register
        $().ready(function() {
            $("#btnConsumerLevelAdd").click(function() {

                if (confirm('Are you sure submit?')) {

                    var consumer_level = $("input[name='txtCONSUMER_LEVEL']")[0].value;
                    var consumer_level_name = $("input[name='txtCONSUMER_LEVEL_NAME']")[0].value;
                    var consumer_level_desc = $("input[name='txtCONSUMER_LEVEL_DESC']")[0].value;

                    $("input[name='btnConsumerLevelAdd']")[0].disabled = "disabled";
                    $("input[name='btnConsumerLevelAdd']")[0].value = "Add Consumer Level...";

                    $.post("/Consumer/AjaxConsumerLevelAdd?" + new Date(), {
                        Action: "post",
                        consumer_level: consumer_level,
                        consumer_level_name: consumer_level_name,
                        consumer_level_desc: consumer_level_desc
                    }, function(result) {
                        if (result.FLAG) {
                            alert("Success");
                            $("input[name='btnConsumerLevelAdd']")[0].disabled = "";
                            $("input[name='btnConsumerLevelAdd']")[0].value = "Add Consumer Level";
                            location.href = "/Consumer/ConsumerLevelAdd";
                        }
                        else {
                            alert(result.DESC);
                            $("input[name='btnConsumerLevelAdd']")[0].disabled = "";
                            $("input[name='btnConsumerLevelAdd']")[0].value = "Add Consumer Level";
                        }
                    })
                }
            })
        })

        $().ready(function() {
            $("#btnGoToList").click(function() {
                location.href = "/Consumer/ConsumerLevelList";
            })
        })

    </script>

</asp:Content>
